package com.zz.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Set;

/**
 * 用户信息
 * @author zhouzi
 */
@Data
@ApiModel("用户信息")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键 学号")
    @NotNull(message = "主键不能为空")
    @Range(min = 1000000000, message = "用户学号为10位")
    private Integer id;

    /**
    * 姓名
    * */
    @ApiModelProperty("姓名")
    private String name;

    /**
    * 手机号
    * */
    @ApiModelProperty("手机号")
    @NotNull(message = "手机号不能为空")
    @Pattern(regexp = "^[0-9]{11}",message = "手机号格式不正确")
    private String phone;

    /**
    * 密码
    * */
    @ApiModelProperty("密码")
    @NotNull(message = "密码不能为空")
    @Length(min = 8, message = "密码长度至少有8位")
    private String password;

    /**
    * 昵称
    * */
    @ApiModelProperty("昵称")
    private String nickname;

    //学院
    @ApiModelProperty("学院")
    private String academy;

    //性别
    @ApiModelProperty("性别")
    private String sex;

    //头像
    @ApiModelProperty("头像")
    private String avatar;

    //社团编码1
    @ApiModelProperty("社团编码1")
    private Integer clubId1;

    //社团编码2
    @ApiModelProperty("社团编码2")
    private Integer clubId2;

    //社团编码3
    @ApiModelProperty("社团编码3")
    private Integer clubId3;


    //用户所具备的权限集合
    @TableField(exist = false)
    private Set<Permission> permissions;

    // 用户所具备的身份集合
    @TableField(exist = false)
    private Set<String> identity;
}
